package com.lm.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lm.mapper.ServeMapper;
import com.lm.pojo.*;
import com.lm.service.OrgService;
import com.lm.service.ServeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Lenovo
 * @version 1.0
 * @description: TODO
 * @date 2025/9/22 9:10
 */
@Service
public class ServeServiceImpl implements ServeService {

    @Autowired
    private ServeMapper serveMapper;


    @Override
    public IPage<Serve> find(Serve serve) {
        IPage<Serve> page = new Page<>(serve.getPageNo(), serve.getPageSize());
        IPage<Serve> pageInfo = serveMapper.findList(page,serve.getServiceRecordState(),serve.getServiceOrgId(),serve.getServiceDoctorTeamId(),serve.getServicePackageId(),serve.getStartTime(),serve.getEndTime());
        return pageInfo;
    }

    @Override
    public List<Organization> findOrg() {
        List<Organization> list=serveMapper.findOrg();
        return list;
    }

    @Override
    public List<DocterTeam> findDoctorTeam(Integer id) {
        List<DocterTeam> list=serveMapper.findDoctorTeam(id);
        return list;
    }

    @Override
    public List<ServicePackage> findServicePackage(Integer teamId) {
        List<ServicePackage> list=serveMapper.findServicePackage(teamId);
        return list;
    }

    @Override
    public List<Docter> findDoctor(Integer teamId) {
        List<Docter> list=serveMapper.findDoctor(teamId);
        return list;
    }

    @Override
    public List<ServiceItem> findItem(Integer packageId) {
        List<ServiceItem> list=serveMapper.findItem(packageId);
        return list;
    }

    @Override
    public List<Resident> search(String name) {
        List<Resident> list=serveMapper.search(name);
        return list;
    }

    @Override
    public List<Resident> familyMembers(Integer residentId) {
        List<Resident> list=serveMapper.familyMembers(residentId);
        return list;
    }

    @Override
    public void insert(Serve serve) {
        serveMapper.serveInsert(serve);
    }

    @Override
    public Serve findServiceById(Integer residentId) {
        Serve list=serveMapper.findServiceById(residentId);
        return list;
    }

    @Override
    public void updateState(Integer serviceRecordId) {
        serveMapper.updateState(serviceRecordId);
    }

    @Override
    public void insertHealth(ServiceHealthInfo serviceHealthInfo) {
        serveMapper.insertHealth(serviceHealthInfo);
    }

    @Override
    public IPage<Serve> findLists(Serve serve) {
        IPage<Serve> page = new Page<>(serve.getPageNo(), serve.getPageSize());
        IPage<Serve> pageInfo = serveMapper.findLists(page,serve.getServiceRecordState(),serve.getServiceOrgId(),serve.getServiceDoctorTeamId(),serve.getServicePackageId(),serve.getStartTime(),serve.getEndTime());
        return pageInfo;
    }

    @Override
    public void updateStates(Integer serviceRecordId, String serviceCancel) {
        serveMapper.updateStates(serviceRecordId,serviceCancel);
    }

    @Override
    public void updateStateBs(Integer serviceRecordId, String serviceInfo) {
        serveMapper.updateStateBs(serviceRecordId,serviceInfo);
    }

    @Override
    public void saveServices(Serve serve) {
        serveMapper.saveServices(serve);
    }

    @Override
    public void updateStateBes(Integer serviceRecordId) {
        serveMapper.updateStateBes(serviceRecordId);
    }


}
